#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@Introduce :
@File      : celery.py
@Time      : 2022/2/16 20:12
@Author    : toby
"""
from __future__ import absolute_import

from celery import Celery

from datetime import timedelta

cel = Celery("celery_task",
broker ="redis://localhost:6379/0",
backend ="redis://localhost:6379/1",
             include=[
                    # 'celery_task.tasks',
                      'celery_task.tasks'])

cel.conf.timezone = 'Asia/Shanghai'
cel.conf.enable_utc = False



# schedules
cel.conf.beat_schedule  = {
    # 'sendmail': {
    #
    #     'task': 'celery_task.tasks.sendmail',
    #      # 'schedule': crontab(minute="*/1"),         # 每 30 秒执行一次
    #     'schedule': timedelta(seconds=20),
    #     'args': ()                           # 任务函数参数
    # },
    'test_celery2': {

            'task': 'celery_task.tasks.sendMail',
             # 'schedule': crontab(minute="*/1"),         # 每 30 秒执行一次
            'schedule': timedelta(seconds=20),
            'args': ()                           # 任务函数参数
        }

}
